package com.study.bigdata.spark.core.rdd.operator.transform

import org.apache.spark.rdd.RDD
import org.apache.spark.{SparkConf, SparkContext}

object Scala04_RDD_Operator_Transform {
  def main(args: Array[String]): Unit = {

    val conf = new SparkConf().setMaster("local[*]").setAppName("RDD")
    val sc = new SparkContext(conf)

    // TODO 算子 - 转换 - 扁平映射:flatMap
    val rdd =sc.makeRDD(
      List(
        "Hello Scala","Hello Spark"
      )
    )

    val rdd1: RDD[String] = rdd.flatMap(_.split(" "))
    rdd1.collect().foreach(println)
    /*
    Hello
    Scala
    Hello
    Spark
     */
    sc.stop()



  }

}
